<template>
	<view class="wrapper">
		<view class="top">
			<u--text text="第1步：选择合作类型" size="14"></u--text>
			<view>
				<u--text color="#f56e3d" @click="toPerfectInfo2" size="14" text="下一步"
					style="text-align: right;"></u--text>
			</view>
		</view>
		<!-- 表单 -->
		<view class="form_wrapper">
			<u-form labelPosition="top" :model="userInfo" ref="uForm" :rules="rules" labelWidth="100">
				<u-form-item prop="phone" borderBottom label="申请号码" >
					<u-input placeholder="请输入手机号" v-model.trim="userInfo.houseUserPhone" type="number" disabled>
					</u-input>
				</u-form-item>
				<u-form-item prop="phone1" borderBottom label="邀请人号码">
					<u-input placeholder="邀请人号码" v-model.trim="userInfo.phone">
					</u-input>
				</u-form-item>
			</u-form>
		</view>
		<view class="bottom_box">
			<u--text text="温馨提示" size="18" bold></u--text>
			<u--text text="如您确定入驻，请提前准备好如下材料哦！" size="15" lineHeight="24"></u--text>
			<u--text text="1、实名认证过的手机号码；" size="14" lineHeight="24"></u--text>
			<u--text text="2、身份证正、反面，手持身份证正面照片；" size="14" lineHeight="24"></u--text>
			<u--text text="3、联系地址" size="14" lineHeight="24"></u--text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo:{
					houseUserPhone: uni.getStorageSync('phone'),
					phone:'',
				},
				btnStyle: {
					marginTop: '20px',
					color: '#fff',
					background: 'rgb(240, 90, 35)',
					height: '40px'
				},
				btnStyleCode: {
					color: '#fff',
					background: 'rgb(240, 90, 35)',
					height: '26px'
				},
				isChecked: false,
				endFlag: true,
				rules: {
					'phone': {
						type: 'string',
						max: 11,
						message: '请输入手机号',
						trigger: ['blur', 'change']
					},
					'phone1': {
						type: 'string',
						max: 11,
						message: '邀请人号码',
						trigger: ['blur', 'change']
					},
				},
			}
		},
		methods: {
			
			 isValidPhoneNumber(phoneNumber) {	
			  const regex = /^(1[3-9]\d{9})$/;
			  return regex.test(phoneNumber);
			},
			toPerfectInfo2(){
				if(!this.userInfo.phone.length==0){
					if(this.isValidPhoneNumber(this.userInfo.phone)){
						uni.navigateTo({
							url:'/pages/home/toPerfectInfo2'
						})
					}else {
						uni.showToast({
							title:'请输入正确的手机号',
							icon:'none'
						})
					}
				}else{
					uni.navigateTo({
						url:'/pages/home/toPerfectInfo2'
					})
				}
				
				
			}
		}
	}
</script>

<style scoped lang="scss">
	.wrapper {
		padding: 20rpx 40rpx;

		.form_wrapper {
			font-size: 28rpx;
		}

		.top {
			padding: 20rpx 0;
			display: flex;
			justify-content: space-around;
			align-items: center;
		}

		.bottom_box {
			padding: 40rpx 0;
		}
	}
</style>